package com.chuangjiangx.member.common.utils;

public class WxSessionKeyUtil {

    private static final String sessionKeyUrl = "https://api.weixin.qq.com/sns/jscode2session";

    private static final String openIdUrl = "https://api.weixin.qq.com/sns/jscode2session";
    /**
     * 微信开放平台通过jscode为小程序获取openid
     */
    private static final String WX_OPEN_ID_URL = "https://api.weixin.qq.com/sns/component/jscode2session";

    /**
     * 微信开放平台-小程序工厂-APPID
     */
    public static final String COMPONENT_APPID="wx562f751a2b1ddab6";

    /**
     * 获取session_key
     * @param req
     * @return
     * @throws Exception
     */
    public static String getSessionKey(String req) throws Exception {
        return AppHttpService.sendGet(sessionKeyUrl, req);
    }

    public static String getOpenIdUrl(String req) throws Exception {
        return AppHttpService.sendGet(openIdUrl, req);
    }


    public static String getWxOpenIdUrl(String req) throws Exception {
        return AppHttpService.sendGet(WX_OPEN_ID_URL, req);
    }

}
